package edu.cibertec.connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DBConnection {
	
public static final String MYSQL="jdbc:mysql://localhost/DB_ACREDITACION?user=root&password=mysql";

static{
	try {
		Class.forName("com.mysql.jdbc.Driver");
	} catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
	public static Connection getConnection(String urlConnection){
		Connection conex=null;
		try {
			conex=DriverManager.getConnection(urlConnection);
		} catch (SQLException e) {
		
			e.printStackTrace();
		}
		return conex;
	}
public static void closeConnection(Connection conex){
	try {
		conex.close();
	} catch (SQLException e) {

		e.printStackTrace();
	}
}
public static void closeStatement(Statement stm){
	try {
		stm.close();
	} catch (SQLException e) {
	
		e.printStackTrace();
	}
}




}
